package com.jsh.controller;


import com.jsh.entity.GoodsAddDTO;
import com.jsh.service.IShopGoodsService;
import com.jsh.uitls.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jsh
 * @since 2022-11-20
 */
@RestController
@RequestMapping("/shop-goods")
@Api(value = "商品信息管理",tags = "商品信息管理")
public class ShopGoodsController {

    @Autowired
    IShopGoodsService iShopGoodsService;

    @ApiOperation("添加商品信息")
    @PostMapping("/add")
    public CommonResult addGoods(@RequestBody GoodsAddDTO goodsAddDTO){
        return iShopGoodsService.addGoods(goodsAddDTO);
    }

    @ApiOperation("根据id查询库存")
    @PostMapping("/get")
   public CommonResult<GoodsAddDTO> getShopGoods(@RequestParam Integer goodsId) {
       return iShopGoodsService.getShopGoods(goodsId);
   }


}

